package 剑指offer.二维数组中的查找_1;

import java.util.Scanner;

public class Solution {
	public static void main(String[] args){
		int target = 2;
		int[][] A = new int[][]{{1,1}}; 
		System.out.println(Find(target, A));
	}
	
	public static boolean Find(int target, int[][]  array) {
		int row = 0;
		int col = array[0].length-1;
		while(row < array.length && col >= 0){
			if(target == array[row][col]) return true;
			else if(target > array[row][col]) row++;
			else col--;
		}
		return false;
	}
	
}
